GUI Help > Create > createButton

createButton
int handle=createButton(int x, int y, int width, int height, str caption, bool flat, handle parent)

Description:
Creates a new button gadget.

Return Value:
Handle to the new button

Parameters:
x X position of new button
y Y position of new button
width Width of new button in pixels
height Height of new gadget in pixels
caption Text which appears on the face of the button
flat 0 for a 3D button, 1 for a flat button
parent Handle to the parent of the new gadget, or 0 for the main window
Remarks:


See Also:


Example:
(Note: You will need to include the GUI constants file for this example to work)

if (not GUI_CONSTANTS) then errorMessage "You need to include the constants file for this example to work"

`Create a 3D button belonging to the main window
buttonA=createButton(10,10,75,25,"3D Button",0,0)

`Create a flat button belonging to the main window
buttonB=createButton(10,50,75,25,"Flat Button",1,0)

do
	getEvent
	
	if eventType()=MOUSE_CLICK
		if eventSource()=buttonA then message "You clicked the 3D Button"
		if eventSource()=buttonB then message "You clicked the Flat Button"
	endif
loop